package states.gameplay;


public class Game {
	public static int GRID_DISPLACEMENT = 24;
	public static int CELL_SIZE = 20;
	
	public static enum State {INIT, PLAY, WIN, LOSE};
	
	public static enum Action {DEPLOY_EXPANDOR, 
							   DEPLOY_ENERGOR, 
							   DEPLOY_STORAGOR, 
							   DEPLOY_WALLOR, 
							   DEPLOY_LIGHT_DEFENDER, 
							   DEPLOY_MEDIUM_DEFENDER, 
							   DEPLOY_HEAVY_DEFENDER
							  };
							   
	public static int DEFAULT_PULSE_TIMER = 1000;
	
	private int _timeToNextPulse;
	private int _pulsation;
	// current gameState
	private State _currentState;
	
	// UI related Stuff
	private Position _mouseCoords;
	private Action _currentAction;
	
	public Game(){
		_timeToNextPulse = DEFAULT_PULSE_TIMER;
				
		setPulsation(DEFAULT_PULSE_TIMER);
		
		_mouseCoords = new Position();
		
		_currentAction = null;
	}
	
	public void resetPulse(){
		setTimeToNextPulse(_pulsation);
	}
	
	public void setTimeToNextPulse(int time){
		int timeToSet = time > 0 ? time : 0;
		
		_timeToNextPulse = timeToSet;
	}
	
	public void removeTimeToPulse(int time){
		_timeToNextPulse -= time;
		
		if(_timeToNextPulse < 0){
			_timeToNextPulse = 0;
		}
	}
	
	public int getTimeToNextPulse(){
		return _timeToNextPulse;
	}

	public int getPulsation() {
		return _pulsation;
	}

	public void setPulsation(int currentPulseTime) {
		this._pulsation = currentPulseTime;
	}

	public State getCurrentState() {
		return _currentState;
	}

	public void setCurrentState(State _currentState) {
		this._currentState = _currentState;
	}

	public Position getMouseCoords() {
		return _mouseCoords;
	}

	public void setMouseCoords(int x, int y) {
		this._mouseCoords.x = x;
		this._mouseCoords.y = y;
	}

	public Action getCurrentAction() {
		return _currentAction;
	}

	public void setCurrentAction(Action _currentAction) {
		this._currentAction = _currentAction;
	}
}
